package com.example.jobback.controller.seeker;

import com.example.jobback.aspect.RateLimit;
import com.example.jobback.req.seeker.company.GetPageCompaniesReq;
import com.example.jobback.resp.seeker.company.CompanyDetailResp;
import com.example.jobback.resp.seeker.company.GetPageCompaniesResp;
import com.example.jobback.resp.seeker.company.SmartRecommendCompanyResp;
import com.example.jobback.result.Result;
import com.example.jobback.service.seeker.SeekerCompanyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: SeekerCompanyController
 * @Description: 求职者-公司控制器
 * @Author: lhb
 * @Date: 2025/7/23
 */
@RestController
@RequestMapping("/seeker/company")
@Tag(name = "求职者-公司控制器",description = "求职者公司服务对应的相关接口")
public class SeekerCompanyController {
    private final SeekerCompanyService seekerCompanyService;

    public SeekerCompanyController(SeekerCompanyService seekerCompanyService) {
        this.seekerCompanyService = seekerCompanyService;
    }

    @RateLimit
    @Operation(summary = "分页获取公司列表",description = "")
    @ApiResponse(description = "返回响应体")
    @PostMapping("/getCompanies")
    public Result<GetPageCompaniesResp> getCompanies(@RequestBody GetPageCompaniesReq req){
        return seekerCompanyService.getCompanies(req);
    }

    @Operation(summary = "获取公司详情",description = "")
    @ApiResponse(description = "返回响应体")
    @GetMapping("/getCompanyDetail")
    public Result<CompanyDetailResp> getCompanyDetail(@Parameter(description = "公司id", required = true)
                                                             @RequestParam Long companyId){
        return seekerCompanyService.getCompanyDetail(companyId);
    }

    @Operation(summary = "获取热门企业城市",description = "这里的热门城市指的是，企业数较多的城市")
    @ApiResponse(description = "返回set的字符串集合，测试阶段如果为空，忽略掉")
    @GetMapping("/getHotCityList")
    public Result<Object> getHotCityList(){
        return seekerCompanyService.getHotCityList();
    }

    @RateLimit
    @Operation(summary = "智能推荐企业",description = "")
    @ApiResponse(description = "")
    @GetMapping("/smartRecommendCompanyList")
    public Result<List<SmartRecommendCompanyResp>> smartRecommendCompanyList(){
        return seekerCompanyService.smartRecommendCompanyList();
    }
}
